<?php
include("connection.php");
include("header.php");
//echo  $ceraterid=$_SESSION['userid'];

?>

<?php

if($_GET['action']=="view")
{
 $id=$_GET['id'];
 
 $q=mysql_query("SELECT * FROM event WHERE id='".$id."'")or die(			    mysql_error());
 
 $row = mysql_fetch_array($q);
 
  	  $eventname=$row["eventname"];
	  $venue=$row["venue"];
	  $date=$row["date"];
	  $starttime=$row["starttime"];
	  $endtime=$row["endtime"];
	  $maixumnumber=$row["maxnum"];
	  $guest=$row["guest"];
	  $des=$row["des"];
	  $payment=$row["payment"];
	  $type=$row["type"];
 
    $time1=$row['time1'];
    $time2=$row['time2'];
	$time3=$row['time3'];
	$time4=$row['time4'];
	$time5=$row['time5'];
	$time6=$row['time6'];
	$time7=$row['time7'];
	$time8=$row['time8'];
	$time9=$row['time9'];
	$time10=$row['time10'];
	
	  $program1=$row['program1'];
	  $program2=$row['program2'];
	  $program3=$row['program3'];
	  $program4=$row['program4'];
	  $program5=$row['program5'];
	  $program6=$row['program6'];
      $program7=$row['program7'];
	  $program8=$row['program8'];
	  $program9=$row['program9'];
	  $program10=$row['program10'];

	 echo'<table width="500" border="1" cellspacing="0" cellpadding="0">
  
    <tr><td>EVENT NAME</td><td>'.$eventname.'</td></tr>
   <tr> <td>VENUE</td><td>'.$venue.'</td></tr>
   <tr> <td>DATE</td><td>'.$date.'</td></tr>
    
    
  </tr>';
	
	
	
	
	
	
	echo "</table>";

}
?>
<?php

$result1=mysql_query("SELECT * FROM event GROUP BY type ASC");
	while($row1 = mysql_fetch_array($result1))
	{
	$ev_type= $row1["type"];
	echo "<h2>".$ev_type."</h2>";
	$result=mysql_query("SELECT * FROM event WHERE type='".$ev_type."'");
	$total = mysql_num_rows($result);
	$i=0;
	 echo'<table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>EVENT NAME</td>
    <td>VENUE</td>
    <td>DATE</td>
    
    
  </tr>';


	while($i< $total)
	{
	$row=mysql_fetch_array($result);
	
	  $eventname = $row['eventname'];
	  $venue=$row["venue"];
	  $date=$row["date"];
	  //$type=$row["type"];
	
	
	echo"
	<tr>
	<td>".$eventname."</td>
	<td>".$venue."</td>
	<td>".$date."</td>
	<td><a href='?action=view&id=".$row["id"]."'>moredetails<a/></td>
	</tr>";
	
	$i++;
	}
	echo "</table>";
	}
	include("footer.php");


?>


